﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;
using DTO;

namespace DAO
{
    public class ThongTinhThanhVienDAO:DataHelperSQLServer
    {
        public ThongTinhThanhVienDAO()
        { }
        public ArrayList getThongTinThanhVien()
        {
            string _query = "SELECT * FROM CHITIETQUEQUAN AS CT INNER JOIN QUEQUAN AS QQ ON CT.QUEQUAN=QQ.MAQUEQUAN";
            DataTable dt = ExecQuery(_query);
            ArrayList arr = ConvertDataTableToArrayList(dt);
            return arr;
        }
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            ThongTinThanhVienDTO _tv = new ThongTinThanhVienDTO();
            try
            {
                _tv.DuongDanHinh = dt.Rows[i]["duongdanhinh"].ToString();
                _tv.GhiChu = dt.Rows[i]["ghichu"].ToString();
                _tv.MaQueQuan = int.Parse(dt.Rows[i]["maquequan"].ToString());
                _tv.MaThanhVien = int.Parse(dt.Rows[i]["mathanhvien"].ToString());
                _tv.TenQueQuan = dt.Rows[i]["tenquequan"].ToString();

            }
            catch (Exception ex)
            {

                throw ex;
            }

            return (object)_tv;
        }

    }
}
